﻿/*********************************************************************************
 *Author:         OnClick
 *Version:        1.0
 *UnityVersion:   2018.3.11f1
 *Date:           2019-04-23
 *Description:    IFramework
 *History:        2018.11--
*********************************************************************************/
using System;

namespace IFramework
{
    public abstract class TransitionCondtion<T> : ITransitionCondtion
    {
        protected T defaultValue;
        protected string condtionName;
        protected TransitionCondtionType condtionType;
        protected T value;

        public Type ObjType { get { return typeof(T); } }
        public object DefaultValue { get { return defaultValue; } }
        public string CondtionName { get { return condtionName; } }
        public TransitionCondtionType CondtionType { get { return condtionType; } }
        public TransitionCondtion(string condtionName,object defaultVal, TransitionCondtionType condtionType)
        {
            this.condtionName = condtionName;
            this.defaultValue = (T)defaultVal;
            SetTransitionCondtionType(condtionType);
        }
        public abstract bool IsMetCondition();
        public abstract void SetTransitionCondtionType(TransitionCondtionType condtionType);


        public virtual void SetDEfaultValue(object value)
        {
            this.defaultValue = (T)value;
        }



        public virtual void SetValue(object value)
        {
            this.value = (T)value;
        }
    }

}
